*Cloud plot sep by gender*

clear

use "Data\kmeans ambition types.dta"

**Keep only those for who we observe ambition type**
keep if wage_growth_ambition!=.

*Keep only couples where we observe both partners
gen temp2=koen
destring temp2, replace
by couple_id aar, sort: egen temp3=mean(temp2)
keep if temp3==1.5
drop temp2 temp3

sort pnr aar

merge 1:1 pnr aar using "Results\tab_B3\Scenario_2\joining_couples.dta"

drop _merge

**Make map
sort pnr aar

gen temp=educ_eika if final_educ==hfaudd
by pnr: egen final_educ_level_3=mean(temp)
drop temp

forvalues i=81(1)85{

replace final_educ_level_3=1 if final_educ==1109`i'
replace final_educ_level_3=1 if final_educ==1110`i'
replace final_educ_level_3=1 if final_educ==1107`i'
replace final_educ_level_3=1 if final_educ==1008`i'
replace final_educ_level_3=1 if final_educ==1023`i'
replace final_educ_level_3=1 if final_educ==1123`i'
replace final_educ_level_3=1 if final_educ==1009`i'
replace final_educ_level_3=1 if final_educ==1022`i'
replace final_educ_level_3=1 if final_educ==1010`i'

}

gen temp=fined if final_educ==hfaudd
by pnr: egen final_educ_level_4=mean(temp)
drop temp

forvalues i=81(1)85{

replace final_educ_level_4=1 if final_educ==1109`i'
replace final_educ_level_4=1 if final_educ==1110`i'
replace final_educ_level_4=1 if final_educ==1107`i'
replace final_educ_level_4=1 if final_educ==1008`i'
replace final_educ_level_4=1 if final_educ==1023`i'
replace final_educ_level_4=1 if final_educ==1123`i'
replace final_educ_level_4=1 if final_educ==1009`i'
replace final_educ_level_4=1 if final_educ==1022`i'
replace final_educ_level_4=1 if final_educ==1010`i'

}


keep if aar==2018
drop if final_educ==. | final_educ==1
sort final_educ

by final_educ: egen final_educ_level_group_3=mean(final_educ_level_3)
by final_educ: egen final_educ_level_group_4=mean(final_educ_level_4)

*men
gen temp=ambition_type_sep if koen=="1"
by final_educ: egen ambition_type_men=mean(temp)
drop temp

gen temp=wage_start_mean_ambition_s_m
by final_educ: egen level_mean_s_m=mean(temp)
drop temp

gen temp=wage_growth_ambition_s_m
by final_educ: egen growth_mean_s_m=mean(temp)
drop temp

gen temp=1 if koen=="1"
by final_educ: egen educ_count_m=count(temp)
drop temp

*women
gen temp=ambition_type_sep if koen=="2"
by final_educ: egen ambition_type_women=mean(temp)
drop temp

gen temp=wage_start_mean_ambition_s_w
by final_educ: egen level_mean_s_w=mean(temp)
drop temp

gen temp=wage_growth_ambition_s_w
by final_educ: egen growth_mean_s_w=mean(temp)
drop temp

gen temp=1 if koen=="2"
by final_educ: egen educ_count_w=count(temp)
drop temp


collapse (first) level_mean_s_m growth_mean_s_m educ_count_m ambition_type_men level_mean_s_w growth_mean_s_w educ_count_w ambition_type_women final_educ_level_group_3 final_educ_level_group_4 ambition_type_k_3_s ambition_type_k_4_s ambition_type_k_5_s, by(final_educ)

gen educ_code=string(final_educ)



*Fig B6a
*Fig men
twoway scatter growth_mean_s_m level_mean_s_m if ambition_type_men==1 & educ_count_m>=10, msymbol(diamond_hollow) mcolor(teal) || ///
scatter growth_mean_s_m level_mean_s_m if ambition_type_men==2 & educ_count_m>=10, msymbol(square_hollow) mcolor(navy) || ///
scatter growth_mean_s_m level_mean_s_m if ambition_type_men==3 & educ_count_m>=10 & growth_mean_s_w<6 & level_mean_s_w>-2, msymbol(triangle_hollow) mcolor(dkorange) || ///
scatter growth_mean_s_m level_mean_s_m if ambition_type_men==4 & educ_count_m>=10 & growth_mean_s_m<6, msymbol(circle_hollow) mcolor(maroon) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)

*Fig B6c
*Fig women
twoway scatter growth_mean_s_w level_mean_s_w if ambition_type_women==1 & educ_count_w>=10, msymbol(diamond_hollow) mcolor(teal) || ///
scatter growth_mean_s_w level_mean_s_w if ambition_type_women==2 & educ_count_w>=10, msymbol(square_hollow) mcolor(navy) || ///
scatter growth_mean_s_w level_mean_s_w if ambition_type_women==3 & educ_count_w>=10 & growth_mean_s_w<6 & level_mean_s_w>-2, msymbol(triangle_hollow) mcolor(dkorange) || ///
scatter growth_mean_s_w level_mean_s_w if ambition_type_women==4 & educ_count_w>=10 & growth_mean_s_w<6, msymbol(circle_hollow) mcolor(maroon) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)

***Examples

*Fig B6b
*men

gen program_name=""

replace program_name="Preschool teacher" if educ_code=="5444" /*1*/
replace program_name="Ordinary HS" if educ_code=="1198" /*1*/
replace program_name="Carpenter" if educ_code=="4283" /*1*/

replace program_name="Teacher" if educ_code=="5440" /*2*/
replace program_name="Nurse" if educ_code=="5166" /*2*/
replace program_name="Architect" if educ_code=="5470" /*2 NOT one of biggest*/

replace program_name="Office clerk" if educ_code=="4981" /*3*/
replace program_name="Business HS" if educ_code=="5098" /*3*/
replace program_name="10th grade*" if educ_code=="111084" /*3*/
replace program_name="Bank advisor" if educ_code=="4986" /*3*/


replace program_name="Business grad" if educ_code=="5703" /*4*/
replace program_name="Medicin" if educ_code=="7170" /*4*/
replace program_name="Law" if educ_code=="7085" /*4*/
replace program_name="Business bach" if educ_code=="5700" /*4*/


twoway scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "5444"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(5) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "5440"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "4981"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "5703"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "1198"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(6) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "5166"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "4283"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code,"5470"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "5098"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "111084"),  msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "4986"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code, "5700"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code,"7170"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_m level_mean_s_m if inlist(educ_code,"7085"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)


*Fig B6d
*women
drop program_name
gen program_name=""

replace program_name="Ordinary HS" if educ_code=="1198" /*1*/
replace program_name="10th grade*" if educ_code=="111084" /*1*/

replace program_name="Preschool teacher" if educ_code=="5444" /*2*/
replace program_name="Carpenter" if educ_code=="4283" /*2*/
replace program_name="Teacher" if educ_code=="5440" /*2*/
replace program_name="Nurse" if educ_code=="5166" /*2*/


replace program_name="Office clerk" if educ_code=="4981" /*3*/
replace program_name="Business HS" if educ_code=="5098" /*3*/
replace program_name="Bank advisor" if educ_code=="4986" /*3*/
replace program_name="Business bach" if educ_code=="5700" /*3*/

replace program_name="Architect" if educ_code=="5470" /*4 NOT one of biggest*/
replace program_name="Business grad" if educ_code=="5703" /*4*/
replace program_name="Medicin" if educ_code=="7170" /*4*/
replace program_name="Law" if educ_code=="7085" /*4*/



twoway scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "1198"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(7) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "5444"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(5) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "4981"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "5470"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "111084"), msymbol(diamond_hollow) mcolor(teal) ///
mlab(program_name) mlabc(black) mlabposition(6) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "4283"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(6) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "5440"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code,"5166"), msymbol(square_hollow) mcolor(navy) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "5098"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "4986"),  msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(3) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "5700"), msymbol(triangle_hollow) mcolor(dkorange) ///
mlab(program_name) mlabc(black) mlabposition(12) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code, "5703"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code,"7170"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) || ///
scatter growth_mean_s_w level_mean_s_w if inlist(educ_code,"7085"), msymbol(circle_hollow) mcolor(maroon) ///
mlab(program_name) mlabc(black) mlabposition(1) ///
xtitle("starting wage (standardized)") ytitle("growth (standardized)") ///
legend(order(1 "low w{sub:0}, low g" 2 "high w{sub:0}, low g" 3 "low w{sub:0}, high g" 4 "high w{sub:0}, high g") position(6) cols(2) rows(2)) graphregion(fcolor(white)) xscale(range(-2 6)) xlabel(-2(2)6) yscale(range(-5 6)) ylabel(-5(5)5)

